home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1995 Steve Hayman
- // Use is governed by the MiscKit license
-
- #import <dbkit/dbkit.h>
- #import <misckit/misckit.h>
-
- @implementation DBTableView( StringValue )
-
- /*
- * I want my MiscShell objects to be able to get StringValues out of
- * a DBTableView (which doesn't support a stringValue: method) so I
- * added this category, which asks the tableview's data source
- * for the value of various objects, and concats them all together.
- *
- * I hereby declare that the stringValue of a table view is
- * all the selected rows, with columns separated by tabs and
- * rows separated by newlines.
- * Steve Hayman
- * Sep 26 1994
- */
-
- - (const char *)stringValue
- {
- DBValue *v = [[DBValue alloc] init];
- MiscString *str = [[MiscString alloc] init];
- unsigned int i;
- DBTableVector *aColumn;
-
- unsigned int aRow = DB_NoIndex;
-
- while ( (aRow = [self selectedRowAfter:aRow]) != DB_NoIndex ) {
- for ( i = 0; i < [self columnCount]; i++ ) {
- aColumn = [[self columnList] objectAt:i];
- [ [self dataSource]
- getValueFor: [aColumn identifier]
- at:aRow
- into: v];
- [str catFromFormat:"%s%s", [v stringValue],
- (i == [self columnCount] - 1) ? "" : "\t"];
- }
- [str cat:"\n"];
- }
- [v free];
- return [str stringValueAndFree];
- }
- @end
-
-
-